﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data.OleDb;

namespace Chamberlain.DAL
{
    public class DataAccess
    {
        public OleDbConnection getConnection()
        {

            OleDbConnection con = null;

            try
            {
                con = new OleDbConnection(@"Provider=" + Propiedades.Default.PROVIDER + ";" + @"data source=" + Propiedades.Default.DATASOURCE);
                con.Open();
            }
            catch (OleDbException e)
            {
                throw new Exception("Error 33.1 - getConnection(): " + e.Message);
            }

            return con;
        }

        public void freeResource(OleDbConnection con)
        {
            try
            {
                if (con != null)
                    con.Close();
            }
            catch (Exception e)
            {
                throw new Exception("Error 33.1 - freeResource(): " + e.Message);
            }
        }
    }
}
